{% extends 'common/_base.html' %}
{% block title %}新建用户{% endblock %}
{% block localcss %}
    <link rel="stylesheet" href="/static/assets/vendors/select2/select2.min.css">
    <link rel="stylesheet" href="/static/assets/css/style.css">
{% endblock %}
{% block content %}
    <nav class="page-breadcrumb">
        <ol class="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="/">首页</a></li>
                <li class="breadcrumb-item"><a href="/accounts/user/list/">本地用户列表</a></li>
                <li class="breadcrumb-item active" aria-current="page">新建用户</li>
            </ol>
        </ol>
    </nav>
    <div class="row">
        <div class="col-md-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">

                    <h6 class="card-title">新建用户</h6>

                    <form method="post" class="forms-sample col-sm-4">
                        <div class="form-group">
                            <label for="username">{{ form.username.label }}</label>
                            <input type="text" class="form-control" id="username" autocomplete="off"
                                   placeholder="" name="username">
                        <p>{% if form.username.errors %}{{ form.username.errors }}{% endif %}</p>

                        </div>
                        <div class="form-group">
                            <label for="nickname">{{ form.nickname.label }}</label>
                            <input type="text" class="form-control" id="nickname" autocomplete="off"
                                   placeholder="" name="nickname">
                            <p>{% if form.username.errors %}{{ form.nickname.errors }}{% endif %}</p>

                        </div>
                        <div class="form-group">
                            <label for="email">{{ form.email.label }}</label>
                            <input type="email" class="form-control" id="email" autocomplete="off"
                                   placeholder="" name="email">
                            <p>{% if form.username.errors %}{{ form.email.errors }}{% endif %}</p>

                        </div>
{#                        <div class="form-group">#}
{#                            <label for="phone">{{ form.phone.label }}</label>#}
{#                            <input type="text" class="form-control" id="phone" autocomplete="off"#}
{#                                   placeholder="" name="phone">#}
{#                            <p>{% if form.username.errors %}{{ form.phone.errors }}{% endif %}</p>#}
{##}
{#                        </div>#}

                        <div class="form-group">
									<label> {{ form.roles.label }}</label>
									<select class="js-example-basic-multiple w-100" multiple="multiple" name="roles">
                                        {% for i in form.roles %}
                                        {{ i }}
                                        {% endfor %}
									</select>
                        </div>
                        <div class="form-check form-check-flat form-check-primary">
                            <label class="form-check-label">
                                <input type="checkbox" class="form-check-input" name="is_lock">
                                {{ form.is_lock.label }}
                            </label>
                        </div>
                        <div class="form-check form-check-flat form-check-primary">
                            <label class="form-check-label">
                                <input type="checkbox" class="form-check-input" name="is_active" checked="checked">
                                {{ form.is_active.label }}
                            </label>
                        </div>
                        <div class="form-check form-check-flat form-check-primary">
                            <label class="form-check-label">
                                <input type="checkbox" class="form-check-input" name="is_superuser">
                                {{ form.is_superuser.label }}
                            </label>
                        </div>
                        <button type="submit" class="btn btn-primary mr-2">提交</button>
                        <a href="/accounts/user/list/" class="btn btn-warning" style="width: 50pt">返回</a>

                    </form>



                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block localjs %}
    <script src="/static/assets/vendors/select2/select2.full.min.js"></script>
    <script src="/static/assets/js/select2.js"></script>
{% endblock %}